package com.extract.es.document;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * @author: chenfenghai
 * @version: 1.0
 * @date: 2020-10-03 14:51
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
@ToString
@Document(indexName = "order",type = "docs")
public class OrderDocument {

    @Id
    private String orderId;

    @Field(type = FieldType.Keyword)
    private String orderCinema;

    @Field(type = FieldType.Keyword)
    private String orderDay;

    @Field(type = FieldType.Double)
    private Double orderPrice;

    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd'T'HH:mm:ss",timezone="GMT+8")
    private Date orderTime;
}
